<!DOCTYPE html>
<html lang="en" class="x-admin-sm" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <meta charset="utf-8">
    <title>发布需求社区</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="交易社区">
    <meta name="description" content="交易社区提供强劲动力">
    <header th:replace="header::html"></header>
    <link rel="stylesheet"  th:href="@{/css/global.css}">
</head>
<body>

<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="/">
            <img src="/images/logo.png" alt="layui">
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this">
                <a href="/" style="font-size: 15px"><i class="iconfont icon-jiaoliu"></i>交流</a>
            </li>
            <li class="layui-nav-item">
                <a href="case/case.html" style="font-size: 15px"><i class="iconfont icon-iconmingxinganli"></i>案例</a>
            </li>
            <li class="layui-nav-item">
                <a href="http://www.baidu.com/" target="_blank" style="font-size: 15px"><i class="iconfont icon-ui"></i>框架</a>
            </li>
        </ul>


        <ul class="layui-nav fly-nav-user">

<!--      <span sec:authorize="isAnonymous()">-->
<span th:if="${ #authentication.principal}==null">
      <!-- 未登入的状态 -->
      <li class="layui-nav-item">
        <a class="iconfont icon-touxiang layui-hide-xs" href="/api-front/getPage?pageName=index"></a>
      </li>
      <li class="layui-nav-item">

        <a href="/api-front/getPage?pageName=login/user-login" style="font-size: 15px">登入</a>
      </li>
      <li class="layui-nav-item">

        <a class="layui-elip" onclick="xadmin.open('注册','/user/add')" permission="sys:user:add" style="font-size: 15px">注册</a>

      </li>
      <li class="layui-nav-item layui-hide-xs">
        <a href="/app/qq/" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" title="QQ登入"
           class="iconfont icon-qq"></a>
      </li>
      <li class="layui-nav-item layui-hide-xs">
        <a href="/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" title="微博登入"
           class="iconfont icon-weibo"></a>
      </li>
       </span>


            <!-- 登入后的状态 -->
<!--            <span sec:authorize="isAuthenticated()">-->
        <span th:if="${ #authentication.principal} !=null">
      <li class="layui-nav-item">
        <a class="fly-nav-avatar" href="javascript:;">
          <cite class="layui-hide-xs"><span sec:authentication="principal.uname"></span></cite>
          <i class="iconfont icon-renzheng layui-hide-xs" title="认证信息：暴躁小天 作者"></i>
          <i class="layui-badge fly-badge-vip layui-hide-xs">VIP3</i>
          <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg">
        </a>
        <dl class="layui-nav-child">
          <dd><a href="/api-front/getPage?pageName=login/personal"><i class="layui-icon">&#xe620;</i>个人中心</a></dd>

          <hr style="margin: 5px 0;">
          <dd><a href="/user/out" style="text-align: center;">退出</a></dd>
        </dl>
      </li>
        </span>

        </ul>
    </div>
</div>


<div class="fly-panel fly-column">
    <div class="layui-container">
        <ul class="layui-clear">
            <li class="layui-hide-xs layui-this"><a href="/api-front/getPage?pageName=index">首页</a></li>
            <span th:if="${#authentication.principal != null}">
        <!-- 用户登入后显示 -->
      <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a onclick="xadmin.open('我的需求','/api-front/user/userNeeds')">我发布的需求</a></li>


            </span>
        </ul>

        <div class="fly-column-right layui-hide-xs">
            <a onclick="xadmin.open('发布需求','/api-front/user/publishing')" class="layui-btn">发布需求</a>
        </div>
        <div class="layui-hide-sm layui-show-xs-block"
             style="margin-top: -10px; padding-bottom: 10px; text-align: center;">
            <a onclick="xadmin.open('发布需求','/api-front/user/publishing')" class="layui-btn">发布需求</a>
        </div>

    </div>
</div>

<div class="layui-container">


  <div class="layui-row layui-col-space15">

    <div class="layui-col-md8">

        <div class="layui-fluid">
            <div class="layui-row  layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form  layui-col-space5">
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" name="ntitle" placeholder="请输入需求标题关键字" autocomplete="off"
                                           class="layui-input">
                                </div>

                                <div class="layui-inline">
                                    <label class="layui-form-label">请选择类型</label>
                                    <div class="layui-input-inline">
                                        <!--            一级-->

                                        <select name="sname" id="ntype" lay-filter="typeAAA" lay-verify="typeAA" >
                                        </select>

                                    </div>
                                </div>


                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn" lay-submit="" lay-filter="search"><i
                                            class="layui-icon">&#xe615;</i></button>
                                </div>
                            </form>
                        </div>
                        <div class="fly-panel layui-card-body" style="margin-bottom: 0;">
                            <table class="layui-hide" id="need" lay-filter="need"></table>
                        </div>

                    </div>
                </div>
            </div>
        </div>



    </div>
        <div class="layui-col-md4">

            <div class="fly-panel">
                <h3 class="fly-panel-title">温馨通道</h3>
                <ul class="fly-panel-main fly-list-static">
                    <li>
                        <a href="http://fly.layui.com/jie/4281/" target="_blank">layui 的 GitHub 及 Gitee (码云)
                            仓库，欢迎Star</a>
                    </li>
                    <li>
                        <a href="http://fly.layui.com/jie/5366/" target="_blank">
                            layui 常见问题的处理和实用干货集锦
                        </a>
                    </li>
                    <li>
                        <a href="http://fly.layui.com/jie/4281/" target="_blank">layui 的 GitHub 及 Gitee (码云)
                            仓库，欢迎Star</a>
                    </li>
                    <li>
                        <a href="http://fly.layui.com/jie/5366/" target="_blank">
                            layui 常见问题的处理和实用干货集锦
                        </a>
                    </li>
                    <li>
                        <a href="http://fly.layui.com/jie/4281/" target="_blank">layui 的 GitHub 及 Gitee (码云)
                            仓库，欢迎Star</a>
                    </li>
                </ul>
            </div>


            <div class="fly-panel fly-signin">
                <div class="fly-panel-title">
                    签到
                    <i class="fly-mid"></i>
                    <a href="javascript:;" class="fly-link" id="LAY_signinHelp">说明</a>
                    <i class="fly-mid"></i>
                    <a href="javascript:;" class="fly-link" id="LAY_signinTop">活跃榜<span class="layui-badge-dot"></span></a>
                    <span class="fly-signin-days">已连续签到<cite>16</cite>天</span>
                </div>
                <div class="fly-panel-main fly-signin-main">
                    <button class="layui-btn layui-btn-danger" id="LAY_signin">今日签到</button>
                    <span>可获得<cite>5</cite>飞吻</span>

                    <!-- 已签到状态 -->
                    <!--
                    <button class="layui-btn layui-btn-disabled">今日已签到</button>
                    <span>获得了<cite>20</cite>飞吻</span>
                    -->
                </div>
            </div>


            <dl class="fly-panel fly-list-one">
                <dt class="fly-panel-title">本周热议</dt>
                <dd>
                    <a href="/404.html">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="/404.html">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>

            </dl>

            <div class="fly-panel">
                <div class="fly-panel-title">
                    这里可作为广告区域
                </div>
                <div class="fly-panel-main">
                    <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu"
                       time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">招收广告位</a>
                </div>
            </div>

            <div class="fly-panel fly-link">
                <h3 class="fly-panel-title">友情链接</h3>
                <dl class="fly-panel-main">
                    <dd><a href="http://www.layui.com/" target="_blank">layui</a>
                    <dd>
                    <dd><a href="http://layim.layui.com/" target="_blank">WebIM</a>
                    <dd>
                    <dd><a href="http://layer.layui.com/" target="_blank">layer</a>
                    <dd>
                    <dd><a href="http://www.layui.com/laydate/" target="_blank">layDate</a>
                    <dd>
                    <dd><a href="" class="fly-link">申请友链</a>
                    <dd>
                </dl>
            </div>

        </div>
    </div>
</div>

<div class="fly-footer">
    <p><a href="http://fly.layui.com/" target="_blank">交易社区</a> 2020 &copy; <a href="http://www.baidu.com/"
                                                                                target="_blank">暴躁小天</a></p>

</div>


<script>
	layui.cache.page = '';
	layui.cache.user = {
		username: '游客'
		, uid: -1
		, avatar: '/images/avatar/00.jpg'
		, experience: 83
		, sex: '男'
	};
	layui.config({
		version: "3.0.0"
		, base: '' //这里实际使用时，建议改成绝对路径
	}).extend({
		fly: 'templates.index'
	}).use('fly');
</script>

<script type="text/javascript">
    var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));
</script>


<script>
  layui.use('table', function () {
    var table = layui.table,
            form = layui.form;
    table.render({
      elem: '#need'
      , url: '/api-front/demand/list' //数据接口
      , page: true //开启分页
      ,skin: 'nob' //行边框风格
      ,even: true //开启隔行背景
      ,limit:15 //设置每页的条数

      , cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
      , response: {
        dataName: 'datas' //规定数据列表的字段名称，默认：data
      }
      , cols: [
        [ //表头

	        {title: '序号', type: 'numbers', width: '5%'}
	      // , {field: 'nid', title: '需求', align: 'center', sort: true, width: "5%", style: 'display:none;'}
          , {field: 'sname', title: '需求类型', align: 'center',unresize :true}
          , {field: 'ntitle', title: '需求标题', align: 'center',unresize :true}
          , {field: 'nmoney', title: '佣金', align: 'center',unresize :true}
          // , {field: 'nstarttime', title: '发布时间', align: 'center',unresize :true,width: "15%"}
          , {field: 'nendtime', title: '结束时间', align: 'center',unresize :true,width: "15%"}
          , {field: 'nrealtime', title: '工期(天)', align: 'center',unresize :true}
          , {field: 'nstate', title: '投标状态', align: 'center',unresize :true}

        ]
      ]



		});


	  //搜索
	  form.on('submit(search)', function (data) {
		  var data = data.field;
		  table.render({
			  elem: '#need'
			  , url: '/api-front/demand/findNeedByFuzzyNeedTitle' //数据接口
			  , page: true //开启分页
			  , where: {
				  "ntitle": data.ntitle,
				  "sname": data.sname
			  }
			  , response: {
				  countName: 'count', //规定数据总数的字段名称，默认：count
				  dataName: 'datas' //规定数据列表的字段名称，默认：data
			  }
			  , cols: [
				  [ //表头

					  {title: '序号', type: 'numbers', width: '5%'}
					  // , {field: 'nid', title: '需求', align: 'center', sort: true, width: "5%", style: 'display:none;'}
					  , {field: 'sname', title: '需求类型', align: 'center',unresize :true}
					  , {field: 'ntitle', title: '需求标题', align: 'center',unresize :true}
					  , {field: 'nmoney', title: '佣金', align: 'center',unresize :true}
					  // , {field: 'nstarttime', title: '发布时间', align: 'center',unresize :true,width: "15%"}
					  , {field: 'nendtime', title: '结束时间', align: 'center',unresize :true,width: "15%"}
					  , {field: 'nrealtime', title: '工期(天)', align: 'center',unresize :true}
					  , {field: 'nstate', title: '投标状态', align: 'center',unresize :true}

				  ]
			  ],

		  });
		  return false;
	  });

//监听行单击事件（双击事件为：rowDouble）
	  table.on('row(need)', function(obj){
		  var data = obj.data;

		  layer.alert(JSON.stringify(data), {
			  title: '当前行数据：'
		  });

		  //标注选中样式
		  obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
	  });


	  // 一级
	  $(function () {
		  $.ajax({
			  url: "/api-front/user/sparentid",
			  data: {},
			  dataType: "json",
			  success: function (results) {
				  $("#ntype").empty();

				  if (results != 0) {
					  $("#ntype").append(new Option("---请选择---", ""));
					  $.each(results, function (index, item) {
						  $('#ntype').append(new Option(item.sname, item.sname));

					  });
				  } else {
					  $("#ntype").append(new Option("暂无数据", ""));

				  }

				  layui.form.render("select");
			  }
		  });

	  });



	});

</script>

</body>
</html>